## 16.2. mSQL System Variables

Before mSQL 2, the only post-install configuration that could be performed was through a few global environment variables. However, mSQL 2.0 introduced a configuration file that allows for a much greater flexibility in setting mSQL's parameters. This section covers both the environment variables and the mSQL 2 specific configuration file.

### 16.2.1. Environment Variables

The following variables are specific to mSQL programs. They may be defined in the current shell or as part of a shell script.

`MSQL_DEBUG`

  The debugging level for the program. This is a number from (no output) to 3 (maximum output).

`MSQL_CONF_FILE`

  The path to the mSQL configuration file as shown later.

In addition, the mSQL programs use the following environment variables that are routinely set as part of the Unix environment.

`USER`

  The username of the current user.

`EDITOR`
`VISUAL`

  The path of the default editor. The msql program uses this program to edit SQL statements if a `\e` command is encountered.

### 16.2.2. The mSQL Configuration File

The mSQL configuration file contains the values of several variables that effect the operation of the mSQL programs. By default, the location of the configuration file is /usr/local/Hughes/msql.conf. This value can be changed by setting the `MSQL_CONF_FILE` environment variable. The configuration file begins with a section name in brackets followed by the variables for that section. Following is a sample `msql.conf` file:

>     [general]

>     Inst_Dir = /usr/local/Hughes
>     mSQL_User = msql
>     Admin_User = root
>     Pid_File = %I/msql2d.pid
>     TCP_Port = 1114
>     UNIX_Port = %I/msql2.sock

>     [system]

>     Msync_Timer = 30
>     Host_Lookup = True
>     Read_Only = False

>     [w3-msql]

>     Auth_Host = NULL
>     Footer = True
>     Force_Private = False

The `general` section affects the operation of all mSQL programs, the msqld `database server uses the system section` and the `w3-msql` section is for the W3-mSQL web/database interaction system. When mSQL reads the configuration files, it replaces the characters `%I` with the location of the mSQL installation on the server machine. The available variables for each section are listed below.

### 16.2.2.1. general

Admin_User

  The username of the account allowed to make changes to the mSQL database as a whole. The default value is `root`.

Inst_Dir

  The location of the mSQL installation. All occurrences of `%I` in the configuration file are replaced with this value. The default value is /usr/local/Hughes.

mSQL_User

  The username of the account that runs the mSQL server daemon. The default value is `msql`.

Pid_File

  The location of the file containing the process `ID` of the running mSQL daemon. The default is `%I/msql2d.pid`.

TCP_Port

  The TCP port number used to connect to a mSQL server (in the case of the client programs) or to listen for incoming connections (in the case of msql2d). The default value is `1114`.

UNIX_Port

  The filename of the Unix socket used to connect to the local mSQL server (in the case of the client programs) or to allow local connections (in the case of msql2d). The default value is `%I/msql2.sock`.

### 16.2.2.2. system

Host_Lookup

  If set to `True', all client connections must be from machines that have valid, verifiable hostnames.

Msync_timer

  The interval (in seconds) at which the data used by the server in RAM is synchronized with the data on disk.

Read_Only

  If set to `True', no modifications are allowed on the database. Only `SELECT` queries are permitted.

### 16.2.2.3. w3-msql

Auth_Host

  The hostname of the machine containing the database server with the W3-Auth tables. If set to `NULL` or omitted, the local server is used.

Footer

  If set to `True', the standard Hughes Technologies footer will be appended to every page.

Force_Private

  If set to `True', only pages that are protected by W3-Auth can be accessed through W3-mSQL. This prevents regular HTML files from being processed through W3-mSQL.

Copyright © 2001 O'Reilly & Associates. All rights reserved.